package com.yanqu.road.server.cmd.activity.qqprivilege;

import com.yanqu.road.entity.activity.suitang.config.SuiTangConfigSync;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.qqprivilege.QQPrivilege;
import com.yanqu.road.pb.activity.suitang.SuiTang;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.activity.qqprivilege.QQPrivilegeActivityModule;
import com.yanqu.road.server.gameplayer.module.activity.suitang.SuiTangModule;
import com.yanqu.road.server.manger.activity.ActivityMgr;
import com.yanqu.road.server.manger.activity.qqprivilege.QQPrivilegeMgr;
import com.yanqu.road.server.manger.activity.suitang.SuiTangMgr;
import com.yanqu.road.server.protocol.ClientProtocol;
import com.yanqu.road.server.protocol.GameErrorCode;
import com.yanqu.road.server.protocol.GameProtocol;

@Cmd(code = GameProtocol.S_QQ_PRIVILEGE_GET_REGISTER_REWARD, desc = "领取注册奖励")
public class QQPrivilegeRegisterCmd extends AbstractCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        if (!ActivityMgr.activityInShowTime(QQPrivilegeMgr.getActivityInfo())) {
            ret = GameErrorCode.E_ACTIVITY_NO_FOUND;
            return;
        }

        player.getModule(QQPrivilegeActivityModule.class).getRegisterReward();
    }

    @Override
    public void sendData(GamePlayer player) {
        if (ret == 0) {
            return;
        }

        QQPrivilege.QQPrivilegeGetRegisterRewardResp.Builder respMsg = QQPrivilege.QQPrivilegeGetRegisterRewardResp.newBuilder();
        respMsg.setRet(ret);
        player.sendPacket(ClientProtocol.U_QQ_PRIVILEGE_GET_REGISTER_REWARD, respMsg);
    }
}
